﻿<UserControl x:Class="TestCaseManagerApp.Views.TestCaseEditView"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
            xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:helpers="clr-namespace:TestCaseManagerCore.Helpers;assembly=TestCaseManagerCore"
             xmlns:local="clr-namespace:TestCaseManagerApp.Views"
             xmlns:convert="clr-namespace:TestCaseManagerCore.BusinessLogic.Converters;assembly=TestCaseManagerCore"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             xmlns:enums="clr-namespace:TestCaseManagerCore.BusinessLogic.Enums;assembly=TestCaseManagerCore"
             mc:Ignorable="d" Loaded="UserControl_Loaded">
    <Grid>      
        <Grid.Resources>
            <convert:TestStepPropertiesConverter x:Key="TestStepPropertiesConverter" />
        </Grid.Resources>
        <Grid.CommandBindings>
            <CommandBinding Command="{x:Static local:TestCaseEditView.SaveCommand}" Executed="btnSaveTestCase_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.SaveAndCloseCommand}" Executed="btnSaveAndCloseTestCase_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.EditStepCommand}" Executed="btnEdit_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.ChangeStepCommand}" Executed="btnChange_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.InsertStepCommand}" Executed="btnInsertStep_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.AssociateTestCommand}" Executed="btnAssociateToAutomation_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.DeleteTestStepCommand}" Executed="deleteStep_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.MoveUpTestStepsCommand}" Executed="moveUp_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.MoveDownTestStepsCommand}" Executed="moveDown_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.AddSharedStepCommand}" Executed="btnAdd_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.ShareStepCommand}" Executed="btnShare_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.CopyTestStepsCommand}" Executed="copyTestSteps_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.CutTestStepsCommand}" Executed="cutTestSteps_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.PasteTestStepsCommand}" Executed="pasteTestSteps_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.UndoCommand}" Executed="btnUndo_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.RedoCommand}" Executed="btnRedo_Click"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.EditSharedStepCommand}" Executed="editSharedStep_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.DuplicateSharedStepCommand}" Executed="duplicateSharedStep_Command"/>
            <CommandBinding Command="{x:Static local:TestCaseEditView.EditTestStepCommand}" Executed="btnEdit_Click"/>
            <CommandBinding Command="{x:Static local:TestCasesInitialView.PreviewCommand}" Executed="PreviewButton_Click"/>
        </Grid.CommandBindings>
        <ProgressBar Name="progressBar" Minimum="0" Maximum="1" Height="16" IsIndeterminate="True" Margin="0,0,0,16" />
        
        <Grid Name="mainGrid" Visibility="Hidden">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Grid Grid.Row="0">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>

                <TextBlock Text="{Binding PageTitle}"  Margin="10,0,10,20" Height="Auto" Width="Auto" FontSize="26" FontWeight="Bold" HorizontalAlignment="Left" Grid.Column="0"/>
                <Button IsEnabled="False" Content="Undo" Margin="0,0,0,20" Name="btnUndo" Width="100" Height="25" VerticalAlignment="Center" IsDefault="True" Click="btnUndo_Click" Grid.Column="1"/>
                <Button IsEnabled="False" Content="Redo" Margin="20,0,10,20" Name="btnRedo" Width="100" Height="25" VerticalAlignment="Center" IsDefault="True" Click="btnRedo_Click" Grid.Column="2"/>
            </Grid>
            
            <Grid Grid.Row="1">
                <Grid.Resources>
                    <ObjectDataProvider x:Key="dataFromEnum" MethodName="GetValues"
                            ObjectType="{x:Type System:Enum}">
                        <ObjectDataProvider.MethodParameters>
                            <x:Type TypeName="enums:Priority"/>
                        </ObjectDataProvider.MethodParameters>
                    </ObjectDataProvider>
                </Grid.Resources>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                        
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition Width="5*"/>
                    <ColumnDefinition Width="5*"/>
                    <ColumnDefinition Width="1.8*"/>
                    <ColumnDefinition Width="2.2*"/>
                </Grid.ColumnDefinitions>                
                
                <TextBlock Text="ID" Margin="10,0,10,0" Height="25" FontWeight="Bold" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0"/>
                <TextBox Text="{Binding TestCaseIdLabel}" Margin="10,0,10,0" Height="25" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" IsReadOnly="True"/>
                <TextBlock Text="Title" Margin="10,0,10,0" Height="25" FontWeight="Bold" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" />
                <TextBox Name="tbTitle" Text="{Binding TestBase.Title}" ToolTip="{Binding TestBase.Title}" HorizontalAlignment="Stretch" Margin="10,0,10,0" Height="25" Grid.Row="1" Grid.Column="1" MaxLength="255"/>
                <TextBlock IsEnabled="{Binding ShowTestCaseSpecificFields}" Text="Suite" Margin="10,0,10,0" Height="25" FontWeight="Bold" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="2"/>
                <TextBox IsEnabled="{Binding ShowTestCaseSpecificFields}" Text="{Binding TestCase.ITestSuiteBase.Title, Mode=OneWay}" Name="tbSuite"
                         Margin="10,0,10,0" Height="25" HorizontalAlignment="Stretch" Grid.Row="1" Grid.Column="2" IsReadOnly="True" />
                <TextBlock Text="Area" Margin="10,0,10,0" Height="25" FontWeight="Bold" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="3"/>
                <ComboBox Height="25" Margin="10,0,10,0" ItemsSource="{Binding Areas}" SelectedValue="{Binding Path=TestBase.Area, Mode=TwoWay}" Name="cbArea" IsTextSearchEnabled="True"
                          IsEditable ="True" helpers:ComboBoxDropdownExtensions.OpenDropDownAutomatically="True" Grid.Row="1" Grid.Column="3"  MouseEnter="cbArea_MouseEnter" MouseMove="cbArea_MouseMove"/>
                <TextBlock Text="Priority" Margin="10,0,10,0" Height="25" FontWeight="Bold" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="4"/>
                <ComboBox Height="25" Margin="10,0,10,0" ItemsSource="{Binding Source={StaticResource dataFromEnum}}" SelectedValue="{Binding Path=TestBase.Priority, Mode=TwoWay}"
                          Name="cbPriority" Grid.Row="1" Grid.Column="4" helpers:ComboBoxDropdownExtensions.OpenDropDownAutomatically="True" MouseEnter="cbPriority_MouseEnter" MouseMove="cbPriority_MouseMove"/>
                <TextBlock IsEnabled="{Binding ShowTestCaseSpecificFields}" Text="Automated" Margin="10,0,10,0" Height="25" FontWeight="Bold" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="5"/>
                <TextBox IsEnabled="{Binding ShowTestCaseSpecificFields}" Text="{Binding TestCase.ITestCase.IsAutomated, Mode=OneWay}" Grid.Row="1" Grid.Column="5" IsReadOnly="True"/>
            </Grid>

            <Grid  Grid.Row="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.7*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1.2*"/>
                    <ColumnDefinition Width="1.2*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid  Grid.Row="0" Grid.ColumnSpan="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1.2*"/>
                        <ColumnDefinition Width="1.2*"/>
                        <ColumnDefinition Width="*" x:Name="Column3"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="Work on Step" Margin="10,20,10,0" Height="25" FontWeight="Bold" HorizontalAlignment="Left" Grid.Row="0"/>

                    <RichTextBox VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,0,10,0" Name="rtbAction" TabIndex="1" Grid.Row="1" Grid.Column="0" GotFocus="rtbStep_GotFocus" LostFocus="rtbStep_LostFocus" />
                    <RichTextBox VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,0,10,0"  Name="rtbExpectedResult" TabIndex="2" Grid.Row="1" Grid.Column="1" GotFocus="rtbExpectedResult_GotFocus" LostFocus="rtbExpectedResult_LostFocus"/>
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Grid.Column="2" Grid.Row="1" IsEnabled="{Binding ShowTestCaseSpecificFields}">
                        <StackPanel Orientation="Vertical" IsEnabled="{Binding ShowTestCaseSpecificFields}">
                            <Button IsEnabled="{Binding IsAutomated}" Content="Ass_ociate" Name="btnAssociateToAutomation" Width="Auto" Height="30" Margin="10,0,10,10" HorizontalAlignment="Left" VerticalAlignment="Center" IsDefault="True" Click="btnAssociateToAutomation_Click"/>
                            <TextBlock Text="Automated Test Type" Margin="10,0,10,10" Height="25" FontWeight="Bold" HorizontalAlignment="Left" />
                            <TextBox Text="{Binding AssociatedAutomation.Type, Mode=OneWay}" Margin="10,0,10,10" Height="25" HorizontalAlignment="Stretch" Grid.Row="1" IsReadOnly="True"/>
                            <TextBlock Text="Automated test storage" Margin="10,0,10,10" Height="25" FontWeight="Bold" HorizontalAlignment="Left" />
                            <TextBox Text="{Binding AssociatedAutomation.Assembly, Mode=OneWay}" Margin="10,0,10,10" Height="25" HorizontalAlignment="Stretch" Grid.Row="1" Grid.Column="1" IsReadOnly="True"/>
                            <TextBlock Text="Automated test name" Margin="10,0,10,10" Height="25" FontWeight="Bold" HorizontalAlignment="Left"/>
                            <TextBox Text="{Binding AssociatedAutomation.TestName, Mode=OneWay}" Margin="10,0,10,10" Height="25" HorizontalAlignment="Stretch" IsReadOnly="True"/>
                        </StackPanel>
                    </ScrollViewer>
                    <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10,0,10">
                        <Button Content="_Insert" Name="btnInsertStep" Width="100" Height="30" Margin="10,0,10,0" VerticalAlignment="Center" IsDefault="True" Click="btnInsertStep_Click" TabIndex="3"/>
                        <Button Content="_Edit" Name="btnEdit" Width="100" Height="30" Margin="10,0,10,0" VerticalAlignment="Center"  Click="btnEdit_Click" TabIndex="4"/>
                        <Button Content="Save" Name="btnSaveTestStep" Width="100" Height="30" Margin="10,0,10,0" VerticalAlignment="Center"  Click="btnSaveTestStep_Click" IsEnabled="False" TabIndex="5"/>
                        <Button Content="Cancel" Name="btnCancelEdit" Width="100" Height="30" Margin="10,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Left" IsEnabled="False" Click="btnCancelEdit_Click" TabIndex="6"/>
                    </StackPanel>
                </Grid>
                
                <GridSplitter Height="5" ResizeDirection="Auto"  HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,5,0,5"/>
                <Grid Grid.Row="2" Grid.ColumnSpan="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    
                    <DataGrid ItemsSource="{Binding ObservableTestSteps}" AutoGenerateColumns="False" Name="dgTestSteps" IsReadOnly="True"
                          IsSynchronizedWithCurrentItem="True" SelectionMode="Extended"  SelectionUnit="FullRow" HorizontalAlignment="Left" Grid.Column="0"  
                              MouseLeftButtonUp="dgTestSteps_MouseLeftButtonUp" PreviewMouseRightButtonDown="dgTestSteps_PreviewMouseRightButtonDown" 
                              SelectedCellsChanged="dgTestSteps_SelectedCellsChanged" LoadingRow="dgTestSteps_LoadingRow" SelectedIndex="0" VirtualizingPanel.ScrollUnit="Pixel">
                        <DataGrid.InputBindings>
                            <KeyBinding Key="C"  Modifiers="Ctrl"  Command="Copy"/>
                            <KeyBinding Key="V"  Modifiers="Ctrl"  Command="Paste"/>
                            <KeyBinding Key="X"  Modifiers="Ctrl"  Command="Cut"/>
                        </DataGrid.InputBindings>
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="Copy"  Executed="copyTestSteps_Command"/>
                            <CommandBinding Command="Paste"  Executed="pasteTestSteps_Command"/>
                            <CommandBinding Command="Cut"  Executed="cutTestSteps_Command"/>
                        </DataGrid.CommandBindings>
                        <DataGrid.ItemContainerStyle>
                            <Style TargetType="{x:Type DataGridRow}"  BasedOn="{StaticResource {x:Type DataGridRow}}">
                                <EventSetter Event="MouseDoubleClick" Handler="dgTestSteps_MouseDoubleClick" />
                            </Style>
                        </DataGrid.ItemContainerStyle>

                        <DataGrid.ContextMenu>
                            <ContextMenu>
                                <MenuItem Name="dgTestStepsCutMenuItem" Command="{x:Static local:TestCaseEditView.CutTestStepsCommand}" Header="Cut" />
                                <MenuItem Name="dgTestStepsCopyMenuItem" Command="{x:Static local:TestCaseEditView.CopyTestStepsCommand}" Header="Copy" />
                                <MenuItem Name="dgTestStepsPasteMenuItem" Command="{x:Static local:TestCaseEditView.PasteTestStepsCommand}" Header="Paste"/>
                                <Separator />
                                <MenuItem Name="dgTestStepsShareMenuItem" Command="{x:Static local:TestCaseEditView.ShareStepCommand}" Header="Share" IsEnabled="{Binding ShowTestCaseSpecificFields}"/>
                                <MenuItem Name="dgTestStepsEditMenuItem" Command="{x:Static local:TestCaseEditView.EditTestStepCommand}" Header="Edit"/>
                                <MenuItem Name="dgTestStepsDeleteMenuItem" Command="{x:Static local:TestCaseEditView.DeleteTestStepCommand}" Header="Delete"/>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTemplateColumn   Header="Shared Step"  Width="150" MaxWidth="200" >
                                <DataGridTemplateColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
                                        <Setter Property="HorizontalContentAlignment" Value="Left"/>
                                    </Style>
                                </DataGridTemplateColumn.HeaderStyle>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Title}" TextWrapping="Wrap" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn   Header="Steps"  Width="5*" >
                                <DataGridTemplateColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
                                        <Setter Property="HorizontalContentAlignment" Value="Left"/>
                                    </Style>
                                </DataGridTemplateColumn.HeaderStyle>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding ActionTitle}" TextWrapping="Wrap" />
                                        <!--<TextBlock Text="{Binding ActionTitle, Converter={StaticResource TestStepPropertiesConverter}}" TextWrapping="Wrap" />-->
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn  Header="Expected Results" Width="5*">
                                <DataGridTemplateColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
                                        <Setter Property="HorizontalContentAlignment" Value="Left"/>
                                    </Style>
                                </DataGridTemplateColumn.HeaderStyle>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding ActionExpectedResult}" TextWrapping="Wrap" />
                                        <!--<TextBlock Text="{Binding ActionExpectedResult, Converter={StaticResource TestStepPropertiesConverter}}" TextWrapping="Wrap" />-->
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                    <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.RowSpan="3">
                        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                <Button Content="_Up" Width="80" Height="30" Margin="5" VerticalAlignment="Center" Name="btnMoveUp"  Click="btnMoveUp_Click"/>
                                <Button Content="_Down" Width="80" Height="30" Margin="5" VerticalAlignment="Center" Name="btnMoveDown"  Click="btnMoveDown_Click"/>
                                <Button Content="_Add" Width="80" Height="30" Margin="5" VerticalAlignment="Center" Name="btnAdd"  Click="btnAdd_Click" IsEnabled="{Binding ShowTestCaseSpecificFields}"/>
                                <Button Content="_Share"  Name="btnShare" Width="80" Height="30" Margin="5" VerticalAlignment="Center" Click="btnShare_Click" TabIndex="6" IsEnabled="{Binding ShowTestCaseSpecificFields}"/>
                                <Button Content="_Delete"  Name="btnDeleteStep" Width="80" Height="30" Margin="5" VerticalAlignment="Center" Click="btnDeleteStep_Click" TabIndex="7"/>
                                <Button Content="_Change"  Name="btnChange" Width="80" Height="30" Margin="5" VerticalAlignment="Center" Click="btnChange_Click" TabIndex="8"/>
                            </StackPanel>
                        </ScrollViewer>                       
                    </StackPanel>
                </Grid>


                <Grid  Grid.Row="2" Grid.Column="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBox Height="25" Margin="10,30,10,10" Name="tbSharedStepFilter" HorizontalAlignment="Stretch" Grid.Row="0" Text="{Binding Path=SharedStepsFilter, Mode=TwoWay}"
                         GotFocus="tbSharedStepFilter_GotFocus" LostFocus="tbSharedStepFilter_LostFocus" KeyUp="tbSharedStepFilter_KeyUp" 
                         IsEnabled="{Binding ShowTestCaseSpecificFields}" />
                    <DataGrid ItemsSource="{Binding ObservableSharedSteps}" AutoGenerateColumns="False" Name="dgSharedSteps" HorizontalScrollBarVisibility="Disabled"
                          IsReadOnly="True" Grid.Row="1" IsEnabled="{Binding ShowTestCaseSpecificFields}"
                          SelectedCellsChanged="dgSharedSteps_SelectedCellsChanged">
                        
                        <DataGrid.ItemContainerStyle>
                            <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
                                <EventSetter Event="MouseDoubleClick" Handler="dgSharedSteps_MouseDoubleClick" />
                                <Setter Property="ContextMenu">
                                    <Setter.Value>
                                        <ContextMenu>
                                            <MenuItem Command="{x:Static local:TestCaseEditView.EditSharedStepCommand}" Header="Edit" IsEnabled="{Binding Path=IsAddEnabled}"/>
                                            <MenuItem Command="{x:Static local:TestCaseEditView.DuplicateSharedStepCommand}" Header="Duplicate" IsEnabled="{Binding Path=IsAddEnabled}"/>
                                        </ContextMenu>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </DataGrid.ItemContainerStyle>
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Title" Binding="{Binding ISharedStep.Title}" Width="400">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
                                        <Setter Property="HorizontalContentAlignment" Value="Left"/>
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                                <DataGridTextColumn.CellStyle>
                                    <Style TargetType="DataGridCell">
                                        <Setter Property="ToolTip" Value="{Binding StepsToolTip}" />
                                    </Style>
                                </DataGridTextColumn.CellStyle>
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
               
            </Grid>
            <StackPanel Orientation="Horizontal" Grid.Row="3">
                <Button Content="SaveAndClose" Height="30" Width="150" Name="btnSaveAndCloseTestCase" Margin="0,20,0,20" VerticalAlignment="Center" IsDefault="True" Click="btnSaveAndCloseTestCase_Click"/>
                <Button Content="Save" Height="30" Width="90" Name="btnSaveTestCase" Margin="20,20,0,20" VerticalAlignment="Center" IsDefault="True" Click="btnSaveTestCase_Click"/>
                <Button Content="Cancel" Height="30" Width="90" Name="btnCancel" Margin="20,20,0,20" VerticalAlignment="Center" IsDefault="True" Click="btnCancel_Click" IsCancel="true"/>
                <Button Content="_Duplicate" Height="30" Width="90" Name="btnDuplicate" Margin="20,20,0,20" VerticalAlignment="Center" IsDefault="True"
                            Click="btnDuplicate_Click" IsEnabled="{Binding ShowTestCaseSpecificFields}"/>
                <Button Name="btnPreview" Content="_Preview" Margin="20,0,10,0" Height="30" Width="90" VerticalAlignment="Center" Click="PreviewButton_Click" IsEnabled="{Binding ShowTestCaseSpecificFields}"/>
                <mui:BBCodeBlock BBCode="[b][size=20]SAVED[/size][/b]"  Margin="20,20,0,20" HorizontalAlignment="Right" Visibility="Hidden" Name="lbSaved"/>
            </StackPanel>

        </Grid>      
    </Grid>       
</UserControl>




<!--<Grid.Resources>
                <Style TargetType="DataGridRow">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsShared}" Value="True">
                            <Setter Property="Background" Value="WhiteSmoke" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Resources>-->